home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / turbovis / tvtool17.zip / PROTOS.H < prev    next >
C/C++ Source or Header  |  1993-10-01  |  3KB  |  102 lines

  1. /***
  2.  *  Copyright (C) 1993   Marc Stern  (internet: stern@mble.philips.be)
  3.  *
  4.  *  File    : protos.h
  5.  *
  6.  *  Description    : General macros to write a function declaration and 
  7.  *                definition once for both types of system: with and 
  8.  *                without prototypes.
  9.  *
  10.  *  OS/Compiler : All
  11.  *
  12.  *  Usage       : -  With a compiler that does not accept prototypes, 
  13.  *                   the NO_PROTO has to be defined through a -D option 
  14.  *                   to the compiler.
  15.  *
  16.  *                -  macro PROTO is intended to be used for prototyping
  17.  *                   or declaring functions (usually inside header files)
  18.  *                   ex:  
  19.  *                       extern int PROTO( read_data, (char*, int) );
  20.  *
  21.  *                -  macros FUNCDEFx are intended to be used for defining 
  22.  *                   functions (inside body files)
  23.  *                   ex:  
  24.  *                        int FUNCDEF2( read_data, char*, buffer, int, length );
  25.  *
  26.  ***/
  27.  
  28.  
  29. #ifndef _PROTOS_H
  30. #define _PROTOS_H
  31.  
  32. #if ! defined(NO_PROTO)
  33. # define PROTO(fct,args)                       \
  34.                   fct args
  35.  
  36. # define FUNCDEF0(f)                           \
  37.                 f(void)
  38.  
  39. # define FUNCDEF1(f,t1,a1)                     \
  40.                 f(t1 a1)
  41.  
  42. # define FUNCDEF2(f,t1,a1,t2,a2)               \
  43.                 f(t1 a1,t2 a2)
  44.  
  45. # define FUNCDEF3(f,t1,a1,t2,a2,t3,a3)         \
  46.                 f(t1 a1,t2 a2,t3 a3)
  47.  
  48. # define FUNCDEF4(f,t1,a1,t2,a2,t3,a3,t4,a4)   \
  49.                 f(t1 a1,t2 a2,t3 a3,t4 a4)
  50.  
  51. # define FUNCDEF5(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5)  \
  52.                 f(t1 a1,t2 a2,t3 a3,t4 a4,t5 a5)
  53.  
  54. # define FUNCDEF6(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6)  \
  55.                 f(t1 a1,t2 a2,t3 a3,t4 a4,t5 a5,t6 a6)
  56.  
  57. # define FUNCDEF7(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7)  \
  58.                 f(t1 a1,t2 a2,t3 a3,t4 a4,t5 a5,t6 a6,t7 a7)
  59.  
  60. # define FUNCDEF8(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7,t8,a8)  \
  61.                 f(t1 a1,t2 a2,t3 a3,t4 a4,t5 a5,t6 a6,t7 a7,t8 a8)
  62. #else /* NO_PROTO */
  63. # define PROTO(fct,args)                       \
  64.                 fct()
  65.  
  66. # define FUNCDEF0(f)                           \
  67.                 f()
  68.  
  69. # define FUNCDEF1(f,t1,a1)                     \
  70.                 f(a1) \
  71.                 t1 a1;
  72.  
  73. # define FUNCDEF2(f,t1,a1,t2,a2)               \
  74.                 f(a1,a2) \
  75.                 t1 a1;t2 a2;
  76.  
  77. # define FUNCDEF3(f,t1,a1,t2,a2,t3,a3)         \
  78.                 f(a1,a2,a3) \
  79.                 t1 a1;t2 a2;t3 a3;
  80.  
  81. # define FUNCDEF4(f,t1,a1,t2,a2,t3,a3,t4,a4)   \
  82.                 f(a1,a2,a3,a4) \
  83.                 t1 a1;t2 a2;t3 a3;t4 a4;
  84.  
  85. # define FUNCDEF5(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5)  \
  86.                 f(a1,a2,a3,a4,a5) \
  87.                 t1 a1;t2 a2;t3 a3;t4 a4;t5 a5;
  88.  
  89. # define FUNCDEF6(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6)  \
  90.                 f(a1,a2,a3,a4,a5,a6) \
  91.                   t1 a1;t2 a2;t3 a3;t4 a4;t5 a5;t6 a6;
  92.  
  93. # define FUNCDEF7(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7)  \
  94.                 f(a1,a2,a3,a4,a5,a6,a7) \
  95.                 t1 a1;t2 a2;t3 a3;t4 a4;t5 a5;t6 a6;t7 a7;
  96. # define FUNCDEF8(f,t1,a1,t2,a2,t3,a3,t4,a4,t5,a5,t6,a6,t7,a7,t8,a8)  \
  97.                 f(a1,a2,a3,a4,a5,a6,a7) \
  98.                 t1 a1;t2 a2;t3 a3;t4 a4;t5 a5;t6 a6;t7 a7;t8 a8;
  99. #endif /* NO_PROTO */
  100.  
  101. #endif /* _PROTOS_H */
  102.